home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGSCAL / INLINE.LZH / FLPT.INC next >
Text File  |  1986-09-24  |  6KB  |  211 lines

  1.                          {FLPT5}
  2. {-------------doesc}
  3. procedure doesc(pk : packet);        {do the esc instr}
  4. begin
  5. If Wait_Found then
  6.   begin  insrtst(instrnames[opcodes[$9b]]); OutUstring; end;
  7. usindex:=firsttab;
  8. insrtst('ESC'); usindex:=secondtab;
  9. insrthx2((opcode and 7)*8+reg);
  10. comma; domem(pk);
  11. end;
  12.  
  13. {-------------st_i}
  14. procedure st_i;         {do st(i) }
  15. begin
  16. insrtst('ST(');
  17. insrtchr(chr(rm+$30));
  18. insrtchr(')');
  19. end;
  20.  
  21. {-------------sti_st}
  22. procedure sti_st;       {do st(i),st }
  23. begin
  24. st_i;
  25. insrtst(',ST');
  26. end;
  27.  
  28. {-------------db}
  29. procedure db;
  30. Const DB_NAME :array[0..11] of string[6] =
  31.            ('FILD','','FIST','FISTP','','FLD','',
  32.             'FSTP','FENI','FDISI','FCLEX','FINIT');
  33. var     i       :word;
  34.         pk : Packet;
  35.         tmp : string[7];
  36. begin
  37. readmodebyte(pk); wd:=false;
  38. if (mode=3) then i:=rm+8 else i:=reg;   {form an index}
  39. tmp:=db_name[i];
  40. if (tmp[0]>#0) and (i<=11) then
  41.    begin
  42.    if not Wait_Found then
  43.      if i>=8 then  {'FENI','FDISI','FCLEX','FINIT' to no wait equivalents}
  44.        Insert('N',tmp,2);
  45.    insrtst(tmp); usindex:=secondtab;
  46.    if i<=3 then
  47.       begin
  48.       insrtst('DWORD '); domem(pk);
  49.       end
  50.    else if i<=7 then
  51.       begin insrtst('TBYTE '); domem(pk); end;
  52.    end
  53. else doesc(pk);
  54. end;
  55.  
  56. {-------------dd}
  57. procedure dd;
  58. Const DD_NAME :array[0..11] of string[6] =
  59.              ('FLD','','FST','FSTP','FRSTOR',
  60.               '','FSAVE','FSTSW','FFREE','FXCH',
  61.               'FST','FSTP');
  62. var     i       :word;
  63.         pk : Packet;
  64.         tmp : string[7];
  65. begin
  66. readmodebyte(pk); wd:=false;
  67. if mode=3 then i:=reg+8 else i:=reg;
  68. tmp:=dd_name[I];
  69. if (tmp[0]>#0) and (i<=11) then
  70.    begin
  71.    if not Wait_Found then
  72.      if (i=6) or (i=7) then  {'FSAVE','FSTSW' to no wait equivalents}
  73.        Insert('N',tmp,2);
  74.    insrtst(tmp); usindex:=secondtab;
  75.    if i<=3 then insrtst('QWORD ');
  76.    if i<=7 then domem(pk)
  77.    else st_i;
  78.    end
  79. else doesc(pk);
  80. end;
  81.  
  82. {-------------df}
  83. procedure df;
  84. Const DF_NAME :array[0..11] of string[5] =
  85.               ('FILD','','FIST','FISTP','FBLD',
  86.                'FILD','FBSTP','FISTP','FFREE','FXCH',
  87.                'FST','FSTP');
  88. var     i       :word;
  89.         pk : Packet;
  90. begin
  91. readmodebyte(pk); wd:=false;
  92. if mode=3 then i:=reg+8 else i:=reg;    {form index}
  93. if (i<>1) and (i<=11) then
  94.    begin
  95.    insrtst(df_name[I]); usindex:=secondtab;
  96.    if i<=3 then
  97.       begin insrtst('WORD '); domem(pk); end
  98.    else if i<=7 then
  99.       begin
  100.       if (i and 5)=4 then insrtst('TBYTE ') else insrtst('QWORD ');
  101.       domem(pk);
  102.       end
  103.    else st_i;
  104.    end
  105. else doesc(pk);
  106. end;
  107.  
  108. {-------------d9}
  109. procedure d9;
  110. Const D9_NAME :array[0..11] of string[6] =
  111.         ('FLD', '', 'FST', 'FSTP',
  112.          'FLDENV', 'FLDCW', 'FSTENV', 'FSTCW',
  113.          'FLD', 'FXCH', 'FNOP', 'FSTP');
  114.  
  115. Const D9_3_NAME :array[0..29] of string[7] =
  116.        ('FCHS','FABS','','','FTST',
  117.         'FXAM','','','FLD1','FLDL2T',
  118.         'FLDL2E','FLDPI','FLDLG2','FLDLN2','FLDZ',
  119.         '','F2XM1','FYL2X','FPTAN','FPATAN',
  120.         'FXTRACT','','FDECSTP','FINCSTP','FPREM',
  121.         'FYL2XP1','FSQRT','','FRNDINT','FSCALE');
  122. var     i       :word;
  123.         pk : Packet;
  124.         tmp : string[7];
  125. begin
  126. readmodebyte(pk);
  127. wd:=false;
  128. if (mode<>3) or (reg<=3) then
  129.    begin
  130.    if mode=3 then i:=reg+8 else i:=reg;
  131.    if (i=1) or ((i=10) and (rm<>0)) then doesc(pk)
  132.    else
  133.       begin
  134.       tmp:=d9_name[I];
  135.       if not Wait_Found then
  136.         if (i=6) or (i=7) then  {'FSTENV', 'FSTCW' to no wait equivalents}
  137.           Insert('N',tmp,2);
  138.       insrtst(tmp);  usindex:=secondtab;
  139.       if i<=3 then insrtst('DWORD ');
  140.       if i<=7 then domem(pk)
  141.       else if i<>10 then        {fnop is 10}
  142.          st_i;  {st(i)}
  143.       end;
  144.    end
  145. else
  146.    begin        {mode=3 and reg>=4}
  147.    i:=rm+(reg and 3)*8; {include lower 2 bits of reg in index}
  148.    if (d9_3_name[I][0]>#0) and (I<=29) then
  149.       insrtst(d9_3_name[I])
  150.    else doesc(pk);
  151.    end;
  152. end;
  153.  
  154. {-------------d8_dc}
  155. procedure d8_dc;
  156. type    nametype=array[0..7] of array[1..5] of char;
  157. var     shortreal       :boolean;
  158.         pk : Packet;
  159. const   d8_dc_name : nametype =(
  160.           'FADD ','FMUL ','FCOM ','FCOMP','FSUB ','FSUBR','FDIV ','FDIVR');
  161. begin
  162. wd:=false;
  163. shortreal:=opcode=$d8;
  164. readmodebyte(pk);
  165. if not shortreal then if (reg>=6) then {fdiv, fdivr are reversed here}
  166.    reg:=reg xor 1;
  167. insrtst(d8_dc_name[reg]);
  168. usindex:=secondtab;
  169. if mode<>3 then
  170.    begin
  171.    if shortreal then insrtst('DWORD ') else insrtst('QWORD ');
  172.    domem(pk);
  173.    end
  174. else  {mode=3}
  175.    if shortreal then
  176.       begin insrtst('ST,'); st_i; end
  177.    else sti_st;                 {add the stack info}
  178. end;
  179.  
  180. {-------------da_de}
  181. procedure da_de;
  182. type    nametype=array[0..15] of array[1..6] of char;
  183. var     shortint        :boolean;
  184.         pk : Packet;
  185. const   da_de_name : nametype = (
  186.         'FIADD ','FIMUL ','FICOM ','FICOMP','FISUB ','FISUBR','FIDIV ',
  187.         'FIDIVR','FADDP ','FMULP ','FCOMP ','FCOMPP','FSUBRP','FSUBP ',
  188.         'FDIVRP','FDIVP ');
  189. begin
  190. wd:=false;
  191. shortint:=opcode=$da;
  192. readmodebyte(pk);
  193. if mode<>3 then
  194.    begin
  195.    insrtst(da_de_name[reg]);
  196.    usindex:=secondtab;
  197.    if shortint then insrtst('DWORD ') else insrtst('WORD ');
  198.    domem(pk);
  199.    end
  200. else
  201.    begin        {mode=3}
  202.    if shortint or ((reg=3) and (rm<>1)) then doesc(pk)      {not fl pt}
  203.    else
  204.       begin
  205.       insrtst(da_de_name[reg+8]);
  206.       usindex:=secondtab;
  207.       if (reg<>3) then sti_st;
  208.       end;
  209.    end;
  210. end;
  211.